﻿<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet  [
    <!ENTITY nbsp   "&#160;">
    <!ENTITY copy   "&#169;">
    <!ENTITY reg    "&#174;">
    <!ENTITY trade  "&#8482;">
    <!ENTITY mdash  "&#8212;">
    <!ENTITY ldquo  "&#8220;">
    <!ENTITY rdquo  "&#8221;">
    <!ENTITY pound  "&#163;">
    <!ENTITY yen    "&#165;">
    <!ENTITY euro   "&#8364;">
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:import href="mainframe.xsl"/>
    <xsl:template name="main">

        <form method="post" name="form1">
            <input type="hidden" name="id" value="{/root/app/id}" />
            <h1>Build App</h1>
            <table border="1" cellpadding="4" cellspacing="0">
                <tr>
                    <th>Name</th>
                    <td>
                        <input type="text" name="name" value="{/root/app/name}" />
                    </td>
                </tr>
                <tr>
                    <th>Description</th>
                    <td>
                        <textarea name="description">
                            <xsl:value-of select="/root/app/description"/>
                        </textarea>
                    </td>
                </tr>
                <tr>
                    <th>&nbsp;</th>
                    <td>
                        <input type="submit" value="Submit" />
                    </td>
                </tr>
            </table>
            <br/>
            <xsl:if test="/root/app/id!=''">
                <a href="?app={/root/app/id}&amp;action=buildentity">Build Entity!</a>
            </xsl:if>
            
            <br/>
            <br/>

            <xsl:if test="/root/app/entities/entity">
                <table border="1" cellpadding="4" cellspacing="0">
                    <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>创建日期</th>
                        <th>操作</th>
                    </tr>
                    <xsl:for-each select="/root/app/entities/entity">
                        <tr>
                            <td>
                                <xsl:value-of select="@name"/>
                            </td>
                            <td>
                                <xsl:value-of select="@zh-cn"/>
                            </td>
                            <td>
                                <xsl:value-of select="@datecreated"/>
                            </td>
                            <td>
                                <a href="?app={/root/app/id}&amp;entity={@name}&amp;action=buildentity">主表</a>&nbsp;
                                <a href="?app={/root/app/id}&amp;entity={@name}&amp;action=buildcategory">分类表</a>&nbsp;
                                <a href="?app={/root/app/id}&amp;entity={@name}&amp;action=buildindex">索引</a>&nbsp;
                            </td>
                        </tr>
                    </xsl:for-each>
                </table>
            </xsl:if>
        </form>
        
    </xsl:template>
</xsl:stylesheet>